package com.onepower.core.utils;

import com.onepower.core.domain.AuthUser;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.Random;

public class SecurityUtils {

    public static Integer getCurrentUserId() {
        AuthUser authentication = (AuthUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return authentication.getId();
    }

    public static String generatorPass() {
        int pwd = new Random().nextInt(90000000) + 10000000;
        return Integer.toString(pwd);
    }
}
